<template>
  <div class="main">
    <el-empty v-show="showSearchList.length === 0" :image-size="100"></el-empty>
    <el-table
        v-show="showSearchList.length !== 0"
        :data="showSearchList"
        style="width: 100%">
      <el-table-column
          label="专家姓名"
          width="200">
        <template slot-scope="scope">
          <i class="el-icon-paperclip"></i>
          <span style="margin-left: 10px">{{ scope.row.name }}</span>
        </template>
      </el-table-column>
      <el-table-column
          label="专家评分"
          width="200">
        <template slot-scope="scope">
          <span v-show="false">{{ expertRate(scope.row) }}</span>
          <el-rate
              v-model="value"
              disabled
              show-score
              text-color="#ff9900"
              score-template="{value}">
          </el-rate>
        </template>
      </el-table-column>
      <el-table-column
          label="专家邮箱"
          width="200">
        <template slot-scope="scope">
          <span style="margin-left: 10px">{{ scope.row.email }}</span>
        </template>
      </el-table-column>
      <el-table-column
          label="专家电话"
          width="200">
        <template slot-scope="scope">
          <span style="margin-left: 10px">{{ scope.row.phone }}</span>
        </template>
      </el-table-column>
      <el-table-column
          label="专家等级"
          width="200">
        <template slot-scope="scope">
          <el-tag size="medium">{{ scope.row.level }}</el-tag>
        </template>
      </el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button
              size="mini"
              @click="handleEdit(scope.$index, scope.row)">查看详细信息</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import {mapMutations, mapState} from "vuex";

export default {
  name: "ShowSearchExpertList",
  data() {
    return {
      value: 0
    }
  },
  methods: {
    handleEdit(index, row) {
      this.SetShowExpert(row)
    },
    expertRate(obj){
      this.value =  obj.tol_rate / obj.question_count
    },
    ...mapMutations("expert",{SetShowExpert:"SetShowExpert"})
  },
  computed:{
    ...mapState("expert",['showSearchList'])
  }
}
</script>

<style scoped>
 .main{
   margin: 0 40px;
 }
</style>